// 运算符
main() {
  // 1. 算术运算符
  int a = 10;
  int b = 20;
  print(a + b);
  print(a - b);
  print(a * b);
  print(a / b);
  print(a ~/ b);
  print(a % b);

  // 2. 赋值运算符
  num a1 = 10.0;
  a1 += b;
  print(a1);
  a1 -= b;
  print(a1);
  a1 *= b;
  print(a1);
  a1 = (a1 / b).toInt();
  print(a1);
  a1 ~/= b;
  print(a1);

print(0.1 +0.2);// 0.30000000000000004
//如何解决doubLe计算精度问题，项目的时候使用三方库进行计算，如：decimal

num price =19.9911111;
print(price.toStringAsFixed(2));//.toFixed（）保留小数，只用于最终展示，不参与中间计算过程

//自增、自减
int age =18;
age++;
print(age);// 11
age--;
print(age);// 10
age--;

// 逻辑运算符（不支持短路运算）
print(a > b && a < 20);
print(a > b || a < 20);
print(!(a > b));

// 关系运算符
print(a > b);
print(a < b);
print(a >= b);
print(a <= b);
print(a == b);
print(a != b);

// 三元运算符
print(1 > 2 ? '大于' : '小于'); // 小于

}
